home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-02 | 1.3 KB | 76 lines | [TEXT/MSET] |
- \ Date - Date/time support
- \ 01/15/85 cbd Version 1
- \ 03/11/87 rfl ability to put any date in and print it
- \ also changed basicstr to bytes
- \ July 90 mrh Mops version. Gives choice as to day and month order.
-
- decimal
-
- true value DMY? \ Set true for day/month/year order (Aussie)
-
- scon DAYNAMES "SunMonTueWedThuFriSat"
-
- :code SECS2DATE \ ( secs dtRec -- )
- pop a0
- pop d0
- call Secs2Date
- ;code
-
- :code GETDATETIME \ Apparently Apple don't want us to just
- \ do $ 20C @ any more.
- clr.l -(a6)
- move.l a6,a0
- exg a6,a7
- call ReadDateTime
- exg a6,a7
- rts
- ;code
-
- : DIG2 0 <# # # #> type ;
-
-
- :class DATETIME super{ object }
- record{
- int Year
- int Month
- int Day
- int Hour
- int Minute
- int Second
- int dayOfWeek
- }
-
- :m GET: \ Gets the system date and time
- getDateTime ^base secs2date ;m
-
- :m PUT: ^base secs2date ;m
-
- :m PRINTDAY:
- get: dayOfWeek 1- 3 * dayNames drop + 3 type ;m
-
- :m PRINTDATE:
- get: day get: month
- DMY? IF swap THEN
- dig2 & / emit dig2 & / emit
- get: year 1900 - dig2 ;m
-
- :m PRINTTIME:
- get: hour dig2 & : emit
- get: minute dig2 & : emit get: second dig2 ;m
-
- :m PRINT:
- printday: self space printdate: self
- 2 spaces printtime: self ;m
-
- ;class
-
- dateTime sysDate
-
- endload
-
- \ To run this, try e.g.:
-
- get: sysDate
- print: sysdate
-
-